
void SDcard_write(char *string){
      
      /*Function to write a string to the SDcard.*/
    
  File SDcard = SD.open("GPSLOG.csv", FILE_WRITE); //Opens file on the SDcard to log GPS data
  char c;
  c = *string++;
  while(c != '\0'){       // \0 denotes end of string

     if (SDcard) {        // Writes data to the SDcard and closes file
      SDcard.print(c);
      }  
    else {
      Serial.println("error writing to GPSLOG.csv");  //If the file is not open error is written
      }
     c = *string++;   //move c to next char of string
  }
  SDcard.close();
}

